<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="tag" tagdir="/WEB-INF/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<tag:head title="管理员管理" ctx="${ctx}"></tag:head>

<tag:body>
	<!-- 左 上 导航 -->
	<tag:nav ctx="${ctx}"></tag:nav>

	<!-- page content -->
	<div class="right_col" role="main">
		<div class="">
			<div class="clearfix"></div>

			<div class="row">
				<div class="col-md-12 col-sm-12 col-xs-12">
					<div class="x_panel">
						<div class="x_title">
							<h2>
								<c:choose>
									<c:when test="${requestScope.blackList != null}">黑名单列表</c:when>
									<c:otherwise>管理员列表</c:otherwise>
								</c:choose>
							</h2>
							<ul class="nav navbar-right panel_toolbox">
								<li>
									<button type="button" class="btn btn-success"><i class="fa fa-user-plus">
									</i> 添加管理员
									</button>
								</li>
								<c:choose>
									<c:when test="${requestScope.blackList != null}">
										<li>
											<button type="button" class="btn btn-primary"><i class="fa fa-child"></i> 全部管理员列表
											</button>
										</li>
									</c:when>
									<c:otherwise>
										<li>
											<button type="button" class="btn btn-warning"><i class="fa fa-frown-o">
											</i> 黑名单列表
											</button>
										</li>
									</c:otherwise>
								</c:choose>
								<li>
									<button type="button" class="btn btn-danger" data-toggle="modal"
											data-target=".bs-example-modal-dag"><i class="fa fa-trash-o"></i>删除选定
									</button>
								</li>
							</ul>
							<div class="clearfix"></div>
						</div>
						<div class="x_content">
							<table id="datatable-checkbox" class="table table-striped table-bordered bulk_action">
								<thead>
								<tr>
									<th width="5%"><input type="checkbox" id="check-all"></th>
									<th width="7%">ID</th>
									<th width="10%">用户名</th>
                                    <th width="7%">状态</th>
									<th width="25%">操作</th>
								</tr>
								</thead>

								<tbody>
								<c:forEach var="admin" items="${requestScope.admins}">
									<tr>
										<td width="5%"><input type="checkbox"  name="table_records"/></td>
										<td width="7%">${admin.administratorId}</td>
										<td width="10%">${admin.username}</td>
                                        <td width="7%">${admin.state}</td>
										<td width="25%">
														<c:choose>
															<c:when test="${admin.state == false}">
																<a href='#' class='btn btn-warning btn-xs' onclick='forbiddenAdmin(this)'><i class='fa fa-minus-square-o'></i> 禁用 </a>
															</c:when>
															<c:otherwise>
																<a href='#' class='btn btn-primary btn-xs' onclick='releaseAdmin(this)'><i class='fa fa-plus-square-o'></i> 解禁 </a>
															</c:otherwise>
														</c:choose>
														<a href='#' class='btn btn-info btn-xs' onclick='editAdmin(this)'><i class='fa fa-pencil'></i> 编辑 </a>
														<a href='#' class='btn btn-danger btn-xs' data-toggle='modal' data-target='.bs-example-modal-da' onclick='deleteAdminInfo(this)'>
                                                          <i class='fa fa-trash'></i>
                                                            删除
                                                         </a>

                                        </td>
									</tr>
								</c:forEach>
								</tbody>
							</table>
                            <div class="dataTables_paginate paging_simple_numbers" id="datatable-checkbox_paginate">
                                <ul class="pagination">
                                    <li class="paginate_button previous disabled" id="datatable-checkbox_previous">
                                        <a href="javascript:void(0)" aria-controls="datatable-checkbox" data-dt-idx="0" tabindex="0">上一页</a>
                                    </li>
                                    <li class="paginate_button next disabled" id="datatable-checkbox_next">
                                        <a href="javascript:void(0)" aria-controls="datatable-checkbox" data-dt-idx="2" tabindex="0">下一页</a>
                                    </li>
                                </ul>
                            </div>
						</div>
					</div>
				</div>

			</div>


		</div>
	</div>
	<!-- /page content -->

	<!-- footer content -->
	<tag:footer></tag:footer>
</tag:body>
<!-- javascript -->
<tag:javascript ctx="${ctx}">
	<script src="${ctx}/assets/js/admin/admin_admin_list/admin_admin_list.js"></script>	<!-- this page -->
	<script>
		<c:if test="${requestScope.error != null}">
			createPNotify("提示信息","error","${requestScope.error}");
		</c:if>
        initTable();

        <c:choose>
        <c:when test="${requestScope.page.pageSize == 10 || requestScope.page.pageSize == 25 || requestScope.page.pageSize == 50 || requestScope.page.pageSize == 100}">
        $("#pageSize").val(${requestScope.page.pageSize});
        </c:when>
        <c:otherwise>
        $("#pageSize").val("all");
        </c:otherwise>
        </c:choose>

        <c:choose>
        <c:when test="${requestScope.blackList == null}">
        createPaging($('#datatable-checkbox_paginate'),${requestScope.page.currentPageNum},${requestScope.page.totalPageNum},'adminList(this)',10);
        </c:when>
        <c:otherwise>
        createPaging($('#datatable-checkbox_paginate'),${requestScope.page.currentPageNum},${requestScope.page.totalPageNum},'blackAdminList(this)',10);
        </c:otherwise>
        </c:choose>
        adjustPagination($("#datatable-checkbox_paginate").children("ul"),${requestScope.page.currentPageNum},${requestScope.page.totalPageNum});

	</script>
</tag:javascript>
</html>

<!-- start:删除管理员 -->
<div class="modal fade bs-example-modal-da" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog modal-sm">
		<div class="modal-content">

			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
						aria-hidden="true">×</span>
				</button>
				<h4 class="modal-title">删除管理员</h4>
			</div>
			<div class="modal-body">
				<h4>确定删除选定的？</h4>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"></label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<h4 class="info">成功或失败提示</h4>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary">确定</button>
			</div>

		</div>
	</div>
</div>
<!-- end:删除员工 -->

<!-- start:删除多个员工 -->
<div class="modal fade bs-example-modal-dag" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-dialog modal-sm">
		<div class="modal-content">

			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
						aria-hidden="true">×</span>
				</button>
				<h4 class="modal-title" id="myModalLabel2">删除管理员</h4>
			</div>
			<div class="modal-body">
				<h4>确定删除选定的？</h4>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"></label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<h4 class="info">成功或失败提示</h4>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary">确定</button>
			</div>

		</div>
	</div>
</div>
<!-- end:删除多个员工 -->
